package com.tywj.panda.user.route

import android.app.Activity
import com.tywj.panda.customer.common.view.paging.BasePagingFragmentSearch
import com.tywj.panda.user.details.UserOrderDetailsActivity
import com.tywj.panda.user.order.UserOrderActivity
import com.tywj.panda.user.order.UserOrderFragment
import com.tywj.lib.core.common.view.BaseFragment
import com.tywj.lib.route.RouteNavigation


/**
 * @desc 我的组件Native路由
 * @author June Yang
 * @date 2020/5/9
 */
object UserRoute {
    // 我的
    const val USER = "/user/user"

    // 我的组件服务
    const val USER_SERVICE = "/user/userService"

    //我的订单(全部、侍收款、已收款、已取消)
    const val USER_ORDER_RECORD = "/user/OrderRecord"

    //我的订单详情
    const val ORDER_RECORD_DETAIL = "/user/OrderRecordDetails"

    //设置
    const val USER_SETTINGS = "/user/settings"

    //关于我们
    const val USER_ABOUT = "/user/about"

    //到人个信息
    const val USER_CENTER_INFO = "/user/userCenter"

    const val USER_NICKNAME = "/user/userNickName"

    //用户反馈
    const val USER_FEEDBACK = "/user/userFeedBack"

    //订单详情
    const val USER_ORDER_DETAILS = "/user/orderDetails"


    /**
     * 获取我的Fragment
     */
    fun getUserFragment(activity: Activity): BaseFragment {
        return RouteNavigation(USER)
            .navigation(activity) as BaseFragment
    }

    /**
     * 跳转至我的订单记录界面
     * @param condition 默认显示的报价Tab（全部，待付款，已收款，已取消），选传，默认显示全部Tab
     */
    fun toOrderRecord(
        condition: String = ""
    ): RouteNavigation {
        return RouteNavigation(USER_ORDER_RECORD)
            .param(UserOrderActivity.PARAM_CONDITION, condition)
    }

    fun getOrderRecordFragment(activity: Activity, type: String): BasePagingFragmentSearch<*, *> {
        return RouteNavigation(ORDER_RECORD_DETAIL)
            .param(UserOrderFragment.PARAM_TYPE_ORDER_STATUS, type)
            .navigation(activity) as BasePagingFragmentSearch<*, *>
    }

    //订单详情
    fun toOrderDetails(orderNo: String): RouteNavigation {
        return RouteNavigation(USER_ORDER_DETAILS).param(UserOrderDetailsActivity.PARAMS_ID, orderNo)
    }
}